<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <include file="Public:head"/>
</head>
<body>
<div class="bg"></div>
<div class="container">
    <div class="line bouncein">
        <div class="xs6 xm4 xs3-move xm4-move">
            <div style="height:150px;"></div>
            <div class="media media-y margin-big-bottom">           
            </div>         
            <form  method="post" class="form">
            <div class="panel loginbox">
                <div class="text-center margin-big padding-big-top"><h1>后台管理中心</h1></div>
                <div class="panel-body" style="padding:30px; padding-bottom:10px; padding-top:10px;">
                    <div class="form-group">
                        <div class="field field-icon-right">
                            <input type="text" class="input input-big" name="username" placeholder="登录账号" data-validate="required:请填写账号" />
                            <span class="icon icon-user margin-small"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="field field-icon-right">
                            <input type="password" class="input input-big" name="password" placeholder="登录密码" data-validate="required:请填写密码" />
                            <span class="icon icon-key margin-small"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="field">
                            <input type="text" class="input input-big code" name="code" placeholder="填写右侧的验证码" data-validate="required:请填写右侧的验证码" />
                           <img src="{:U('verity')}" width="100" height="32" class="passcode" style="height:43px;cursor:pointer;" onclick="this.src=this.src+'?suij='+Math.random();" >
                                                   
                        </div>
                    </div>
                </div>
                <div style="padding:30px;"><input type="button" class="button button-block bg-main text-big input-big sub_btn" value="登录"></div>
            </div>
            </form>          
        </div>
    </div>
</div>
</body>
<script src="/Public/js/md5.js"></script>
<script type="text/javascript">
   $('.sub_btn').click(function () {
       if($('input[name="password"]').val()!=''){
           $('input[name="password"]').val(hex_md5($('input[name="password"]').val()));
       }
       $.post("{:U('index')}",$('.form').serialize(),function(msg){
           if(msg.status == 0){
               $('input[name="password"]').val('');
               $('.code').val('');
               $('img').attr('src','/index.php/Admin/Login/verity/suij='+Math.random());
               sweetAlert({title:'',text: msg.info,type: "warning",timer:2000,showConfirmButton: false});
           }
           if(msg.status == 1){
               sweetAlert({title:'',text: msg.info,type: "success",showConfirmButton: false});
               setTimeout(function(){window.location.href="{:U('Index/index')}"},2000);
           }
       });
   })
   $(document).keyup(function(event){
       if(event.keyCode ==13){
           $(".sub_btn").trigger("click");
       }
   });
</script>
</html>